HAL PKA types migration ¶
This section provides information about the HAL PKA types migration.
HAL PKA callback ID type definition ¶
|
HAL1 |
HAL2 |
|---|---|
typedef enum
{
HAL_PKA_OPERATION_COMPLETE_CB_ID
HAL_PKA_ERROR_CB_ID
HAL_PKA_MSPINIT_CB_ID
HAL_PKA_MSPDEINIT_CB_ID
} HAL_PKA_CallbackIDTypeDef;
|
Removed. Note The callback registration in HAL2 is handled by specific functions for each PKA event. See HAL PKA callbacks register and unregister functions for more details. |
Related concept: Individual callback registration APIs replace global register and unregister functions
HAL PKA state type definition ¶
|
HAL1 |
HAL2 |
|---|---|
typedef enum
{
HAL_PKA_STATE_RESET
HAL_PKA_STATE_READY
HAL_PKA_STATE_BUSY
HAL_PKA_STATE_ERROR
} HAL_PKA_StateTypeDef;
|
typedef enum
{
HAL_PKA_STATE_RESET
HAL_PKA_STATE_INIT
HAL_PKA_STATE_IDLE
HAL_PKA_STATE_ACTIVE
} hal_pka_state_t;
|
Related concept: Revised and optimized HAL state machine
Note
The rest of all structures have been renamed and are related to the following concepts:
HAL PKA operation type definition ¶
|
HAL1 |
HAL2 |
|---|---|
typedef struct
{
uint32_t size;
const uint32_t *pOp1;
const uint32_t *pOp2;
} PKA_AddInTypeDef, PKA_SubInTypeDef, PKA_MulInTypeDef, PKA_CmpInTypeDef;
|
typedef struct
{
uint32_t size_byte;
const uint8_t *p_operand_1;
const uint8_t *p_operand_2;
} hal_pka_add_config_t, hal_pka_sub_config_t, hal_pka_mul_config_t, hal_pka_cmp_config_t;
|
HAL PKA ECC complete addition input type definition ¶
|
HAL1 |
HAL2 |
|---|---|
typedef struct
{
uint32_t modulusSize;
uint32_t coefSign;
const uint8_t *modulus;
const uint8_t *coefA;
const uint8_t *basePointX1;
const uint8_t *basePointY1;
const uint8_t *basePointZ1;
const uint8_t *basePointX2;
const uint8_t *basePointY2;
const uint8_t *basePointZ2;
} PKA_ECCCompleteAdditionInTypeDef;
|
typedef struct
{
uint32_t modulus_size_byte;
uint32_t coeff_sign;
const uint8_t *p_modulus;
const uint8_t *p_coeff_a;
const uint8_t *p_base_pt_x_1;
const uint8_t *p_base_pt_y_1;
const uint8_t *p_base_pt_z_1;
const uint8_t *p_base_pt_x_2;
const uint8_t *p_base_pt_y_2;
const uint8_t *p_base_pt_z_2;
} hal_pka_ecc_complete_add_config_t;
|
HAL PKA ECC complete addition output type definition ¶
|
HAL1 |
HAL2 |
|---|---|
typedef struct
{
uint8_t *ptX;
uint8_t *ptY;
uint8_t *ptZ;
} PKA_ECCCompleteAdditionOutTypeDef;
|
typedef struct
{
uint8_t *p_pt_x;
uint8_t *p_pt_y;
uint8_t *p_pt_z;
} hal_pka_ecc_complete_add_result_t;
|
HAL PKA ECC double base ladder input type definition ¶
|
HAL1 |
HAL2 |
|---|---|
typedef struct
{
uint32_t primeOrderSize;
uint32_t modulusSize;
uint32_t coefSign;
const uint8_t *coefA;
const uint8_t *modulus;
const uint8_t *integerK;
const uint8_t *integerM;
const uint8_t *basePointX1;
const uint8_t *basePointY1;
const uint8_t *basePointZ1;
const uint8_t *basePointX2;
const uint8_t *basePointY2;
const uint8_t *basePointZ2;
} PKA_ECCDoubleBaseLadderInTypeDef;
|
typedef struct
{
uint32_t prime_order_size_byte;
uint32_t modulus_size_byte;
uint32_t coeff_sign;
const uint8_t *p_coeff_a;
const uint8_t *p_modulus;
const uint8_t *p_integer_k;
const uint8_t *p_integer_m;
const uint8_t *p_base_pt_x_1;
const uint8_t *p_base_pt_y_1;
const uint8_t *p_base_pt_z_1;
const uint8_t *p_base_pt_x_2;
const uint8_t *p_base_pt_y_2;
const uint8_t *p_base_pt_z_2;
} hal_pka_ecc_double_base_ladder_config_t;
|
HAL PKA ECC double base ladder output type definition ¶
|
HAL1 |
HAL2 |
|---|---|
typedef struct
{
uint8_t *ptX;
uint8_t *ptY;
} PKA_ECDSASignOutExtParamTypeDef, PKA_ECCMulOutTypeDef, PKA_ECCProjective2AffineOutTypeDef,
PKA_ECCDoubleBaseLadderOutTypeDef;
|
typedef struct
{
uint8_t *p_pt_x;
uint8_t *p_pt_y;
} hal_pka_ecdsa_signature_result_ext_config_t, hal_pka_ecc_projective_to_affine_result_t,
hal_pka_ecc_double_base_ladder_result_t, hal_pka_ecc_mul_protect_result_t;
|
Note
For some STM32 series use the following structure instead:
typedef struct
{
uint8_t *p_pt_x;
uint8_t *p_pt_y;
} hal_pka_ecdsa_signature_result_ext_config_t, hal_pka_ecc_projective_to_affine_result_t,
hal_pka_ecc_double_base_ladder_result_t, hal_pka_ecc_mul_result_t, hal_pka_ecc_mul_fast_result_t;
HAL PKA multiplication type definition ¶
In HAL2, the structures
PKA_ECCMulInTypeDef
and
PKA_ECCMulExInTypeDef
have been merged into a single structure,
hal_pka_ecc_mul_protect_config_t, with the addition of the
prime_order_size_byte
field.
|
HAL1 |
HAL2 |
|---|---|
typedef struct
{
uint32_t scalarMulSize;
uint32_t modulusSize;
uint32_t coefSign;
const uint8_t *coefA;
const uint8_t *coefB;
const uint8_t *modulus;
const uint8_t *pointX;
const uint8_t *pointY;
const uint8_t *scalarMul;
const uint8_t *primeOrder;
} PKA_ECCMulInTypeDef;
typedef struct
{
uint32_t primeOrderSize;
uint32_t scalarMulSize;
uint32_t modulusSize;
uint32_t coefSign;
const uint8_t *coefA;
const uint8_t *coefB;
const uint8_t *modulus;
const uint8_t *pointX;
const uint8_t *pointY;
const uint8_t *scalarMul;
const uint8_t *primeOrder;
} PKA_ECCMulExInTypeDef;
|
typedef struct
{
uint32_t prime_order_size_byte;
uint32_t scalar_mul_size_byte;
uint32_t modulus_size_byte;
uint32_t coeff_sign;
const uint8_t *p_coeff_a;
const uint8_t *p_coeff_b;
const uint8_t *p_modulus;
const uint8_t *p_pt_x;
const uint8_t *p_pt_y;
const uint8_t *p_scalar_mul;
const uint8_t *p_prime_order;
} hal_pka_ecc_mul_protect_config_t;
|
In other STM32 series:
|
HAL1 |
HAL2 |
|---|---|
typedef struct
{
uint32_t scalarMulSize;
uint32_t modulusSize;
uint32_t coefSign;
const uint8_t *coefA;
const uint8_t *modulus;
const uint8_t *pointX;
const uint8_t *pointY;
const uint8_t *scalarMul;
} PKA_ECCMulInTypeDef;
|
typedef struct
{
uint32_t scalar_mul_size_byte;
uint32_t modulus_size_byte;
uint32_t coeff_sign;
const uint8_t *p_coeff_a;
const uint8_t *p_modulus;
const uint8_t *p_pt_x;
const uint8_t *p_pt_y;
const uint8_t *p_scalar_mul;
} hal_pka_ecc_mul_config_t;
|
HAL PKA multiplication in fast mode structure ¶
|
HAL1 |
HAL2 |
|---|---|
typedef struct
{
uint32_t scalarMulSize;
uint32_t modulusSize;
uint32_t coefSign;
const uint8_t *coefA;
const uint8_t *modulus;
const uint8_t *pointX;
const uint8_t *pointY;
const uint8_t *scalarMul;
const uint32_t *pMontgomeryParam;
} PKA_ECCMulFastModeInTypeDef;
|
typedef struct
{
uint32_t scalar_mul_size_byte;
uint32_t modulus_size_byte;
uint32_t coeff_sign;
const uint8_t *p_coeff_a;
const uint8_t *p_modulus;
const uint8_t *p_pt_x;
const uint8_t *p_pt_y;
const uint8_t *p_scalar_mul;
const uint8_t *p_montgomery_r2;
} hal_pka_ecc_mul_fast_config_t;
|
HAL PKA ECC projective to affine input type definition ¶
|
HAL1 |
HAL2 |
|---|---|
typedef struct
{
uint32_t modulusSize;
const uint8_t *modulus;
const uint8_t *basePointX;
const uint8_t *basePointY;
const uint8_t *basePointZ;
const uint32_t *pMontgomeryParam;
} PKA_ECCProjective2AffineInTypeDef;
|
typedef struct
{
uint32_t modulus_size_byte;
const uint8_t *p_modulus;
const uint8_t *p_base_pt_x;
const uint8_t *p_base_pt_y;
const uint8_t *p_base_pt_z;
const uint8_t *p_montgomery_param;
} hal_pka_ecc_projective_to_affine_config_t;
|
HAL PKA ECDSA signature input type definition ¶
|
HAL1 |
HAL2 |
|---|---|
typedef struct
{
uint32_t primeOrderSize;
uint32_t modulusSize;
uint32_t coefSign;
const uint8_t *coef;
const uint8_t *coefB;
const uint8_t *modulus;
const uint8_t *integer;
const uint8_t *basePointX;
const uint8_t *basePointY;
const uint8_t *hash;
const uint8_t *privateKey;
const uint8_t *primeOrder;
} PKA_ECDSASignInTypeDef;
|
typedef struct
{
uint32_t prime_order_size_byte;
uint32_t modulus_size_byte;
uint32_t coeff_sign;
const uint8_t *p_coeff;
const uint8_t *p_coeff_b;
const uint8_t *p_modulus;
const uint8_t *p_integer;
const uint8_t *p_base_pt_x;
const uint8_t *p_base_pt_y;
const uint8_t *p_hash;
const uint8_t *p_private_key;
const uint8_t *p_prime_order;
} hal_pka_ecdsa_signature_protect_config_t;
|
In other STM32 series:
|
HAL1 |
HAL2 |
|---|---|
typedef struct
{
uint32_t primeOrderSize;
uint32_t modulusSize;
uint32_t coefSign;
const uint8_t *coef;
const uint8_t *modulus;
const uint8_t *integer;
const uint8_t *basePointX;
const uint8_t *basePointY;
const uint8_t *hash;
const uint8_t *privateKey;
const uint8_t *primeOrder;
} PKA_ECDSASignInTypeDef;
|
typedef struct
{
uint32_t prime_order_size_byte;
uint32_t modulus_size_byte;
uint32_t coeff_sign;
const uint8_t *p_coeff;
const uint8_t *p_modulus;
const uint8_t *p_integer;
const uint8_t *p_base_pt_x;
const uint8_t *p_base_pt_y;
const uint8_t *p_hash;
const uint8_t *p_private_key;
const uint8_t *p_prime_order;
} hal_pka_ecdsa_signature_config_t;
|
HAL PKA ECDSA signature output type definition ¶
|
HAL1 |
HAL2 |
|---|---|
typedef struct
{
uint8_t *RSign;
uint8_t *SSign;
} PKA_ECDSASignOutTypeDef;
|
typedef struct
{
uint8_t *p_r_sign;
uint8_t *p_s_sign;
} hal_pka_ecdsa_signature_protect_result_t;
|
Note
For some STM32 series use the following structure instead:
typedef struct
{
uint8_t *p_r_sign;
uint8_t *p_s_sign;
} hal_pka_ecdsa_signature_result_t;
HAL PKA ECDSA verification input type definition ¶
|
HAL1 |
HAL2 |
|---|---|
typedef struct
{
uint32_t primeOrderSize;
uint32_t modulusSize;
uint32_t coefSign;
const uint8_t *coef;
const uint8_t *modulus;
const uint8_t *basePointX;
const uint8_t *basePointY;
const uint8_t *pPubKeyCurvePtX;
const uint8_t *pPubKeyCurvePtY;
const uint8_t *RSign;
const uint8_t *SSign;
const uint8_t *hash;
const uint8_t *primeOrder;
} PKA_ECDSAVerifInTypeDef;
|
typedef struct
{
uint32_t prime_order_size_byte;
uint32_t modulus_size_byte;
uint32_t coeff_sign;
const uint8_t *p_coeff;
const uint8_t *p_modulus;
const uint8_t *p_base_pt_x;
const uint8_t *p_base_pt_y;
const uint8_t *p_pub_key_curve_pt_x;
const uint8_t *p_pub_key_curve_pt_y;
const uint8_t *p_r_sign;
const uint8_t *p_s_sign;
const uint8_t *p_hash;
const uint8_t *p_prime_order;
} hal_pka_ecdsa_verif_config_t;
|
HAL PKA mode type definition ¶
|
HAL1 |
HAL2 |
|---|---|
typedef struct
{
uint32_t size;
const uint32_t *pOp1;
const uint32_t *pOp2;
const uint8_t *pOp3;
} PKA_ModAddInTypeDef, PKA_ModSubInTypeDef, PKA_MontgomeryMulInTypeDef;
|
typedef struct
{
uint32_t size_byte;
const uint8_t *p_operand_1;
const uint8_t *p_operand_2;
const uint8_t *p_operand_3;
} hal_pka_mod_add_config_t, hal_pka_mod_sub_config_t, hal_pka_montgomery_mul_config_t;
|
HAL PKA exponentiation fast mode type definition ¶
|
HAL1 |
HAL2 |
|---|---|
typedef struct
{
uint32_t expSize;
uint32_t OpSize;
const uint8_t *pExp;
const uint8_t *pOp1;
const uint8_t *pMod;
const uint32_t *pMontgomeryParam;
} PKA_ModExpFastModeInTypeDef;
|
typedef struct
{
uint32_t exponent_size_byte;
uint32_t operand_size_byte;
const uint8_t *p_exponent;
const uint8_t *p_operand;
const uint8_t *p_modulus;
const uint8_t *p_montgomery_param;
} hal_pka_mod_exp_fast_config_t;
|
HAL PKA exponentiation mode type definition ¶
|
HAL1 |
HAL2 |
|---|---|
typedef struct
{
uint32_t expSize;
uint32_t OpSize;
const uint8_t *pExp;
const uint8_t *pOp1;
const uint8_t *pMod;
} PKA_ModExpInTypeDef;
|
typedef struct
{
uint32_t exponent_size_byte;
uint32_t operand_size_byte;
const uint8_t *p_exponent;
const uint8_t *p_operand;
const uint8_t *p_modulus;
} hal_pka_mod_exp_config_t;
|
HAL PKA exponentiation protect mode type definition ¶
|
HAL1 |
HAL2 |
|---|---|
typedef struct
{
uint32_t expSize;
uint32_t OpSize;
const uint8_t *pOp1;
const uint8_t *pExp;
const uint8_t *pMod;
const uint8_t *pPhi;
} PKA_ModExpProtectModeInTypeDef;
|
typedef struct
{
uint32_t exponent_size_byte;
uint32_t operand_size_byte;
const uint8_t *p_operand;
const uint8_t *p_exponent;
const uint8_t *p_modulus;
const uint8_t *p_phi;
} hal_pka_mod_exp_protect_config_t;
|
HAL PKA inversion mode type definition ¶
|
HAL1 |
HAL2 |
|---|---|
typedef struct
{
uint32_t size;
const uint32_t *pOp1;
const uint8_t *pMod;
} PKA_ModInvInTypeDef;
|
typedef struct
{
uint32_t size_byte;
const uint8_t *p_operand;
const uint8_t *p_modulus;
} hal_pka_mod_inv_config_t;
|
HAL PKA reduction mode type definition ¶
|
HAL1 |
HAL2 |
|---|---|
typedef struct
{
uint32_t OpSize;
uint32_t modSize;
const uint32_t *pOp1;
const uint8_t *pMod;
} PKA_ModRedInTypeDef;
|
typedef struct
{
uint32_t operand_size_byte;
uint32_t modulus_size_byte;
const uint8_t *p_operand;
const uint8_t *p_modulus;
} hal_pka_mod_red_config_t;
|
HAL PKA montgomery parameter type definition ¶
|
HAL1 |
HAL2 |
|---|---|
typedef struct
{
uint32_t size;
const uint8_t *pOp1;
} PKA_MontgomeryParamInTypeDef;
|
typedef struct
{
uint32_t size_byte;
const uint8_t *p_operand;
} hal_pka_montgomery_config_t;
|
HAL PKA point check type definition ¶
|
HAL1 |
HAL2 |
|---|---|
typedef struct
{
uint32_t modulusSize;
uint32_t coefSign;
const uint8_t *coefA;
const uint8_t *coefB;
const uint8_t *modulus;
const uint8_t *pointX;
const uint8_t *pointY;
const uint32_t *pMontgomeryParam;
} PKA_PointCheckInTypeDef;
|
typedef struct
{
uint32_t modulus_size_byte;
uint32_t coeff_sign;
const uint8_t *p_montgomery_param;
const uint8_t *p_coeff_a;
const uint8_t *p_coeff_b;
const uint8_t *p_modulus;
const uint8_t *p_pt_x;
const uint8_t *p_pt_y;
} hal_pka_point_check_config_t;
|
HAL PKA RSA CRT exponentiation type definition ¶
|
HAL1 |
HAL2 |
|---|---|
typedef struct
{
uint32_t size;
const uint8_t *pOpDp;
const uint8_t *pOpDq;
const uint8_t *pOpQinv;
const uint8_t *pPrimeP;
const uint8_t *pPrimeQ;
const uint8_t *popA;
} PKA_RSACRTExpInTypeDef;
|
typedef struct
{
uint32_t size_byte;
const uint8_t *p_operand_dp;
const uint8_t *p_operand_dq;
const uint8_t *p_operand_qinv;
const uint8_t *p_prime_p;
const uint8_t *p_prime_q;
const uint8_t *p_operand_a;
} hal_pka_rsa_crt_exp_config_t;
|
HAL PKA callback type definition ¶
|
HAL1 |
HAL2 |
|---|---|
|
pPKA_CallbackTypeDef |
hal_pka_cb_t |
HAL PKA handle type definition ¶
|
HAL1 |
HAL2 |
|---|---|
PKA_HandleTypeDef
|
hal_pka_handle_t
|
Related concept: Renaming of the handle structure